{include file="common/_meta" /}
<title>栏目添加</title>
<meta name="keywords" content="李志立，lizhilimaster@163.com">
<meta name="description" content="李志立，lizhilimaster@163.com">
</head>
<body>
<div class="page-container">
	<form action="" method="post" class="form form-horizontal" id="form-category-add-lizhili">
		<input type="hidden"  value="{$data.id}" name="id">
		<input type="hidden"  value="{$data.st}" name="st">
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">
				<span class="c-red">*</span>
				中文名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" onKeyUp="zhuan()"  value="{$data.cnname}" <?php if($data['st'] == '1'){ echo 'disabled'; }?>  placeholder="" id="cnname" name="cnname">
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">
				<span class="c-red">*</span>
				英文名称：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$data.enname}" <?php if($data['st'] == '1'){ echo 'disabled'; }?> placeholder="" id="enname" name="enname">
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">
				<span class="c-red">*</span>
				配置类型：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<span class="select-box">
				<select class="select" id="type" <?php if($data['st'] == '1'){ echo 'disabled'; }?> name="type">
					<option value>请选择类型</option>
					<option {if condition="$data.type == 1 "}selected="selected"{/if} value="1">单行文本</option>
					<option {if condition="$data.type == 2 "}selected="selected"{/if} value="2">多行文本</option>
					<option {if condition="$data.type == 3 "}selected="selected"{/if} value="3">单按钮</option>
					<option {if condition="$data.type == 4 "}selected="selected"{/if} value="4">上传图片</option>
				</select>
				</span>
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">
				配置可选值：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<input type="text" class="input-text" value="{$data.kxvalue}" placeholder="用英文逗号分隔" id="kxvalue" name="kxvalue">
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl">
			<label class="form-label col-xs-3 col-sm-2">配置简介：</label>
			<div class="formControls col-xs-8 col-sm-9">
				<textarea name="desc" id="desc" class="textarea"  onKeyUp="textlength()">{$data.desc}</textarea>
				<p class="textarea-numberbar"><em class="textarea-length">{$data.desc|mb_strlen}</em>/200</p>
			</div>
			<div class="col-3">
			</div>
		</div>
		<div class="row cl">
			<div class="col-9 col-offset-2">
				<input class="btn btn-primary radius" type="submit" value="&nbsp;&nbsp;提交&nbsp;&nbsp;">
			</div>
		</div>
	</form>
</div>
{include file="common/_footer" /}
<script type="text/javascript" src="__MANAGE__lib/jquery.validation/1.14.0/jquery.validate.js"></script> 
<script type="text/javascript" src="__MANAGE__lib/jquery.validation/1.14.0/validate-methods.js"></script> 
<script type="text/javascript" src="__MANAGE__lib/jquery.validation/1.14.0/messages_zh.js"></script>
<script type="text/javascript" src="__MANAGE__lib/function.js"></script>
<script type="text/javascript">
$(function(){
	$('.skin-minimal input').iCheck({
		checkboxClass: 'icheckbox-blue',
		radioClass: 'iradio-blue',
		increaseArea: '20%'
	});
	let wo=$("#form-category-add-lizhili").validate({
		rules:{
			cnname:{
				required:true,
			},
			enname:{
				required:true,
			},
			type:{
				required:true,
			},
		},
		submitHandler:function(form) {
			$("input[type=\"submit\"]").addClass('disabled').attr("disabled",true);
			var index = layer.load(1, {
				shade: [0.1,'#fff'] //0.1透明度的白色背景
			});
			setTimeout(()=>{
				$("input[type=\"submit\"]").removeClass('disabled').attr("disabled",false);
				layer.close(index);
			},1000)
			form.submit();
		}
	});
});
function textlength(){
	var nmb=$('#desc').val().length;
	if(nmb>200){
		$('#desc').css("background-color","orangered");
		$('#desc').val($('#desc').val().substr(0,200));
		$('.textarea-length').text(200);
	}else{
		$('#desc').css("background-color","white");
		$('.textarea-length').text(nmb);
	}
}
function zhuan(){
	$('#enname').val(getPinYinByName($('#cnname').val()));
}
</script>
</body>
</html>